<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head>
<body>
    <input type="password" id="pwd">
    <script>
        let eye=document.querySelector('#eye');
        let pwd=document.querySelector('#pwd');
        eye.onclick=function(){
            if(pwd.type='password'){
                pwd.type='text';

            }else{
                pwd.type='password';
            }
        }
    </script>
</body>
</html>